<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div
        @contextmenu.stop="emit('onContextMenuChild', $event, index)"
        v-for="(item, index) in props.info.showpieceList"
        :key="index"
        class="item-parent"
        :class="{ 'item-parent-0': index === 0 }"
      >
        <div
          class="exhibits-item"
          :class="{
            'exhibits-item-1': (index + 1) % 2 !== 0,
          }"
          :style="{
            'background-image': `url(${publicUrls + 'free/style8/exhibitionStandStyle5Bg.webp'})`,
          }"
        >  
          <div
            class="cover-box"
            @click="viewImg(item.moduleId, item.id)"
            :style="{
              'background-image': `url(${publicUrls + 'free/style8/exhibitionStandStyle5BgCover.webp'})`,
            }"
          >
            <div class="cover-content">
              <div class="title-shadow">
                <p class="title-box">{{ item.name }}</p>
              </div>
              <img class="cover" :src="getLinkUrl(item.coverUrl,'?imageView2/3/w/600/format/webp')" alt="" />
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free8Style3',
});
</script>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  justify-content: center;
  z-index: 999;
  padding: 0 !important;
  // -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.5));
}

.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}

.list {
  width: 100%;
  display: flex;
  justify-content: center;
}
.item-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 429.82px;
  height: 694px;
  margin-left: 31.18px;
}
.item-parent-0 {
  margin-left: 0px;
}
.exhibits-item {
  position: relative;
  width: 429.82px;
  height: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  margin-top: 94px;
  .cover-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 345.61px;
    height: 337.42px;
    overflow: hidden;
    position: relative;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 9px 17.61px 9px 9px;
    &:hover .title-shadow {
      opacity: 1;
    }
    .cover-content {
      position: relative;
      width: 319px;
      height: 319px;
      overflow: hidden;
      border-radius: 50%;
    }
    .cover {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: all 0.3s ease;
    }
  }
}

.exhibits-item-1 {
  margin-top: 0px;
}
.title-shadow {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  width: 319px;
  height: 319px;
  border-radius: 50%;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  z-index: 10;
}
.title-box {
  width: 183px;
  max-height: 56px;
  color: rgba(255, 255, 255, 1);
  font-family: SourceHanSerifCN-Bold;
  font-size: 18px;    
  line-height: 28px;   
  overflow: hidden;  
  text-overflow: ellipsis;  
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 限制行数 */
  -webkit-box-orient: vertical;
  text-align: center;
}
</style>
